var _menu = [ {
	"rsID" : 1,
	"rsName" : "家校通",
	"rsDesc" : "家校通",
	"rsURL" : "home.html",
	"rsType" : "MENU",
	"rsLevel" : 1,
	"sort" : "A",
	"iconClass" : "icon-wallet",
	"rsPID" : 0
}, {
	"rsID" : 21,
	"rsName" : "组织机构",
	"rsDesc" : "组织机构",
	"rsType" : "MENU",
	"rsLevel" : 2,
	"sort" : "AB",
	"iconClass" : "icon-wallet",
	"rsPID" : 1
},{
	"rsID" : 22,
	"rsName" : "部门管理",
	"rsDesc" : "部门管理",
	"rsURL" : "apps/jxt/sch-org/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 21
},{
	"rsID" : 23,
	"rsName" : "教职工管理",
	"rsDesc" : "教职工管理",
	"rsURL" : "apps/jxt/sch-tch/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 21
}, {
	"rsID" : 24,
	"rsName" : "学籍管理",
	"rsDesc" : "学籍管理",
	"rsType" : "MENU",
	"rsLevel" : 2,
	"sort" : "AB",
	"iconClass" : "icon-wallet",
	"rsPID" : 1
},{
	"rsID" : 25,
	"rsName" : "班级管理",
	"rsDesc" : "班级管理",
	"rsURL" : "apps/jxt/sch-class/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 24
},{
	"rsID" : 26,
	"rsName" : "学生管理",
	"rsDesc" : "学生管理",
	"rsURL" : "apps/jxt/sch-student/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 24
}, {
	"rsID" : 3,
	"rsName" : "消息管理(家长版)",
	"rsDesc" : "发消息管理(家长版)",
	"rsURL" : "apps/system/resource/add.html",
	"rsType" : "MENU",
	"rsLevel" : 2,
	"sort" : "AB",
	"iconClass" : "icon-wallet",
	"rsPID" : 1
}, {
	"rsID" : 14,
	"rsName" : "分组管理(家长版)",
	"rsDesc" : "分组管理(家长版)",
	"rsURL" : "apps/jxt/group/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 3
}, {
	"rsID" : 15,
	"rsName" : "发消息(家长版)",
	"rsDesc" : "发消息(家长版)",
	"rsURL" : "apps/jxt/send-msg/edit.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABB",
	"iconClass" : "icon-wallet",
	"rsPID" : 3
}, {
	"rsID" : 16,
	"rsName" : "我发送的信息(家长版)",
	"rsDesc" : "我发送的信息(家长版)",
	"rsURL" : "apps/jxt/my-msg/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABC",
	"iconClass" : "icon-wallet",
	"rsPID" : 3
},{
	"rsID" : 17,
	"rsName" : "消息管理(学校版)",
	"rsDesc" : "发消息管理(学校版)",
	"rsURL" : "apps/system/resource/add.html",
	"rsType" : "MENU",
	"rsLevel" : 2,
	"sort" : "AB",
	"iconClass" : "icon-wallet",
	"rsPID" : 1
}, {
	"rsID" : 18,
	"rsName" : "分组管理(学校版)",
	"rsDesc" : "分组管理(学校版)",
	"rsURL" : "apps/jxt/sch-group/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABA",
	"iconClass" : "\ticon-wallet",
	"rsPID" : 17
}, {
	"rsID" : 19,
	"rsName" : "发消息(学校版)",
	"rsDesc" : "发消息(学校版)",
	"rsURL" : "apps/jxt/sch-send-msg/edit.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABB",
	"iconClass" : "icon-wallet",
	"rsPID" : 17
}, {
	"rsID" : 20,
	"rsName" : "我发送的信息(学校版)",
	"rsDesc" : "我发送的信息(学校版)",
	"rsURL" : "apps/jxt/sch-my-msg/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "ABC",
	"iconClass" : "icon-wallet",
	"rsPID" : 17
}];

var _menu2 = [{
	"rsID" : 2,
	"rsName" : "用户",
	"rsDesc" : "用户管理",
	"rsURL" : "home.html",
	"rsType" : "MENU",
	"rsLevel" : 1,
	"sort" : "B",
	"iconClass" : "icon-wallet",
	"rsPID" : 0
}, {
	"rsID" : 4,
	"rsName" : "消息管理",
	"rsDesc" : "消息管理",
	"rsType" : "MENU",
	"rsLevel" : 2,
	"sort" : "BA",
	"iconClass" : "icon-wallet",
	"rsPID" : 2
}, {
	"rsID" : 39,
	"rsName" : "发消息",
	"rsDesc" : "发消息",
	"rsURL" : "apps/system/msg-send/add.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "BAA",
	"iconClass" : "icon-wallet",
	"rsPID" : 4
}, {
	"rsID" : 40,
	"rsName" : "历史记录",
	"rsDesc" : "发消息的历史记录",
	"rsURL" : "apps/system/msg-task/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "BAB",
	"iconClass" : "icon-wallet",
	"rsPID" : 4
}, {
	"rsID" : 43,
	"rsName" : "消息任务",
	"rsDesc" : "消息任务管理",
	"rsURL" : "apps/system/message-task/list.html",
	"rsType" : "MENU",
	"rsLevel" : 3,
	"sort" : "BAC",
	"iconClass" : "icon-wallet",
	"rsPID" : 4
} ];

var logindata=new Vue({
    el:'#logindata',
    data:{
        userName:'',
        userPWD:''
    }
});

function tip_ini(){
    $("#tip-top").css("display","none");
}

function login_check(){
	session.setMenu(_menu);
    window.location.href="apps/jxt/sch-org/list.html";
}

function login_check_bak(){
    $.post({//提交数据
        url:'operate/support/sysPublic/login',//直接写除掉项目名之后的路径
        data:logindata._data,//获取vue绑定的数据，一定要用_data获取.
        success:function(res){//服务端返回成功的回调
            if(res.body.isSuccess=="true"){
            	session.setToken(res.body.token);
				var res = $.post({//提交数据
					url:'operate/support/sysPersCenter/getMyInfo',//创建用户的url
					async:false,
					data:{iess:res.body.userName}
				}).responseText;
            	session.setUser(JSON.parse(res)['body']);
            	
            	var menu = $.post({//提交数据
            		url:'operate/support/sysPublic/getMyMenus',//创建用户的url
            		async:false
            	}).responseText;
            	session.setMenu(JSON.parse(menu)['body']);
                window.location.href="home.html";
            }else{
                console.log("back_flase");
                $("#tip-msg").text(res.header.message);
                $("#tip-top").css("display","block");
                $('.form-group input').val('');
            }
        },
        error:function(data){//返回错误
                var error=data.responseText;
                error=JSON.parse(error);
                $("#tip-msg").text(error.header.message);
                $("#tip-top").css("display","block");
                $('.form-group input').val('');

        }
    });
}

document.onkeydown=keyDownSearch;
function keyDownSearch(e) {
    // 兼容FF和IE和Opera
    var theEvent = e || window.event;
    var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
    if (code == 13) {
        login_check();
        return false;
    }
    return true;
}
